'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc.  All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH RSM_GET_SEGMENTID_RANGE 3RSM "May 8, 2003"
.SH NAME
rsm_get_segmentid_range \- get segment ID range
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lrsm [ \fIlibrary\fR... ]
#include <rsmapi.h>

\fBint\fR \fBrsm_get_segmentid_range\fR(\fBconst char *\fR\fIappid\fR,
     \fBrsm_memseg_id_t *\fR\fIbaseid\fR, \fBuint32_t *\fR\fIlength\fR);
.fi

.SH DESCRIPTION
.sp
.LP
RSM segment IDs can be either specified by the application or generated by the
system using the  \fBrsm_memseg_export_publish\fR(3RSM) function. Applications
that specify segment IDs require a reserved range of segment IDs that they can
use. This can be achieved by using \fBrsm_get_segmentid_range()\fR and by
reserving a range of segment IDs in the segment ID configuration file,
\fB/etc/rsm/rsm.segmentid\fR. The \fBrsm_get_segmentid_range()\fR function can
be used by applications to obtain the segment ID range reserved for them. The
\fIappid\fR argument is a null-terminated string that identifies the
application. The \fIbaseid\fR argument points to the location where the
starting segment ID of the reserved range is returned. The \fIlength\fR
argument points to the location where the number of reserved segment IDs is
returned.
.sp
.LP
The application can use any value starting at \fIbaseid\fR and less than
\fIbaseid\fR+\fIlength\fR. The application should use an offset within the
range of reserved segment IDs to obtain a segment ID such that if the
\fIbaseid\fR or \fIlength\fR is modified, it will still be within its reserved
range.
.sp
.LP
It is the responsibility of the system administrator to make sure that the
segment ID ranges are properly administered (such that they are
non-overlapping, the file on various nodes of the cluster have identical
entries, and so forth.) Entries in the \fB/etc/rsm/rsm.segmentid\fR file are of
the form:
.sp
.in +2
.nf
#keyword	     appid    baseid    length
reserved     SUNWfoo  0x600000  1000
.fi
.in -2
.sp

.sp
.LP
The fields in the file are separated by tabs or blanks. The first string is a
keyword "reserve", followed by the application identifier (a string without
spaces), the baseid (the starting segment ID of the reserved range in
hexadecimal), and the length (the number of segmentids reserved). Comment lines
contain a "#" in the first column. The file should not contain blank or empty
lines. Segment IDs reserved for the system are defined in the
<\fB/usr/include/rsm/rsm_common.h\fR> header and cannot be used by the
applications.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, these functions return 0. Otherwise, an error value
is returned to indicate the error.
.SH ERRORS
.sp
.LP
The \fBrsm_get_segmentid_range()\fR function can return the following errors:
.sp
.ne 2
.na
\fB\fBRSMERR_BAD_ADDR\fR \fR
.ad
.RS 21n
The address passed is invalid.
.RE

.sp
.ne 2
.na
\fB\fBRSMERR_BAD_APPID\fR \fR
.ad
.RS 21n
The \fIappid\fR is not defined in configuration file.
.RE

.sp
.ne 2
.na
\fB\fBRSMERR_BAD_CONF\fR \fR
.ad
.RS 21n
The configuration file is not present or not readable, or the configuration
file format is incorrect.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
l | l
l | l .
ATTRIBUTE TYPE 	ATTRIBUTE VALUE
_
Interface Stability	Unstable
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR rsm_memseg_export_publish (3RSM),
.BR attributes (7)
